import React, { Suspense } from "react";
import { Outlet } from "react-router-dom";
import { Spin } from "antd";
import styled from "styled-components";

const LoadingContainer = styled.div`
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
`;

const Layout: React.FC = () => {
  return (
    <Suspense
      fallback={
        <LoadingContainer>
          <Spin size="large" tip="加载中..." />
        </LoadingContainer>
      }
    >
      <Outlet />
    </Suspense>
  );
};

export default Layout;
